
import org.scalatest.{DoNotDiscover, FlatSpec, Ignore}

import scala.collection.mutable

/**
  * 1. Informers
  * 2. Documenters
  * 3. Notifiers and Alerters
  * 4. Pending Test
  *
  * In summary, use info and markup for text that should form part of the specification output.
  * Use note and alert to send status notifications.
  * (Because the HTML reporter is intended to produce a readable, printable specification,
  * info and markup text will appear in the HTML report, but note and alert text will not.)
  */

//@Ignore
//@DoNotDiscover
class FlatSpecDemo extends FlatSpec {
  behavior of "An empty Set by behaviour"
  it should "have size 0" in {
    assert(Set.empty.size === 0)
  }

  it should "produce NoSuchElementException when head is invoked" in {
    assertThrows[NoSuchElementException] {
      Set.empty.head
    }
  }

  "An empty Set" should "have size 0" in {
    assert(Set.empty.size === 0)
  }

  it should "produce NoSuchElementException when head is invoked" in {
    assertThrows[NoSuchElementException] {
      Set.empty.head
    }
  }

  "An empty list" must "have size 0" in {
    assert(List.empty.size === 0)
  }
  it should "produce NoSuchElementException when head is invoked" in {
    assertThrows[NoSuchElementException] {
      Set.empty.head
    }
  }

  "The combinators" should "be easy to learn" in {}

  they should "be efficient" in {
    assert(List("1", "22") == List("1", "22"))
  }

  //Ignored tests
  ignore should "do something cool" in {}

  "An empty Set12" should "have size 0" ignore {
    assert(Set.empty.size === 0)
  }

  it should "produce NoSuchElementException when head is invoked" in {
    assertThrows[NoSuchElementException] {
      Set.empty.head
    }
  }
  /**
    * Notifiers and alerters
    * Because note and alert information is sent immediately,
    * it will appear before the test name in string reporters,
    * and its color will be unrelated to the ultimate outcome of the test:
    * note text will always appear in green, alert text will always appear in yellow
    */

  "A mutable Set" should "allow an element to be added" in {
    info("info is recorded")
    markup("markup is *also* recorded")
    note("notes are sent immediately")
    alert("alerts are also sent immediately")
    val set = mutable.Set.empty[String]
    set += "clarity"
    assert(set.size === 1)
    assert(set.contains("clarity"))
  }

  /**
    * Another example is slowpoke notifications.
    * If you find a test is taking a long time to complete,
    * but you're not sure which test, you can enable slowpoke notifications.
    * ScalaTest will use an Alerter to fire an event
    * whenever a test has been running longer than a specified amount of time
    */
}